package com.zzl.springboot;

import com.github.pagehelper.PageInfo;
import com.zzl.springboot.entity.User;
import com.zzl.springboot.mapper.UserMapper;
import com.zzl.springboot.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @program: AAAzzl
 * @description:
 * @author: zzl
 * @create: 2022-11-19 11:19
 * @version:1.0
 **/

// 让测试在Spring环境下进行，若没有此注解，将导致对象注册失败
@RunWith(SpringRunner.class)
@SpringBootTest
public class test {


    @Resource
    UserService userService;
    @Resource
    UserMapper userMapper;


    @Test
    public void testVol(){
        User user = new User();
        user.setUsername("大苏打");
        user.setPassword("123");
        user.setRoleId(3);
        user.setState((byte) 1);
        user.setCreateTime(new Date());
        Integer integer = userMapper.addUser(user);
        System.out.println(integer);
        System.out.println(user.getId());
    }
}
